home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Misc / GMS / GMSDev / Includes / graphics / blitter.i < prev    next >
Encoding:
Text File  |  1997-11-05  |  13.2 KB  |  364 lines

  1.     IFND GRAPHICS_BLITTER_I
  2. GRAPHICS_BLITTER_I SET  1
  3.  
  4. **
  5. **  $VER: blitter.i V0.9B
  6. **
  7. **  Blitter Module Definitions
  8. **
  9. **  (C) Copyright 1996-1997 DreamWorld Productions.
  10. **      All Rights Reserved.
  11. **
  12.  
  13.     IFND    DPKERNEL_I
  14.     include 'games/dpkernel.i'
  15.     ENDC
  16.  
  17. *****************************************************************************
  18. * Module definitions.
  19.  
  20. BlitModVersion  = 0
  21. BlitModRevision = 9
  22.  
  23. *****************************************************************************
  24. * Pixel definitions.
  25.  
  26.    STRUCTURE    PXL,00
  27.     WORD    PXL_XCoord
  28.     WORD    PXL_YCoord
  29.     LONG    PXL_Colour
  30.     LABEL    PXL_SIZEOF
  31.  
  32. PIXEL    MACRO
  33.     dc.w    \1,\2
  34.     dc.l    \3
  35.     ENDM
  36.  
  37. SKIPPIXEL =    -32000
  38.  
  39. *****************************************************************************
  40. * Bitmap structure, used for blitting.
  41.  
  42. BMVERSION   = 1
  43. TAGS_BITMAP = (ID_SPCTAGS<<16)|ID_BITMAP
  44.  
  45.    STRUCTURE    BMP1,HEAD_SIZEOF ;[00] Standard header.
  46.     APTR    BMP_Data         ;[12] Pointer to bitmap data area.
  47.     WORD    BMP_Width        ;[16] Width.
  48.     WORD    BMP_ByteWidth    ;[18] ByteWidth.
  49.     WORD    BMP_Height       ;[20] Height.
  50.     WORD    BMP_Type         ;[22] Type.
  51.     LONG    BMP_LineMod      ;[24] Line differential.
  52.     LONG    BMP_PlaneMod     ;[28] Plane differential.
  53.     APTR    BMP_Parent       ;[32] Bitmap owner.
  54.     APTR    BMP_Restore      ;[36] Restore list for this bitmap, if any.
  55.     LONG    BMP_Size         ;[40] Total size of the bitmap in bytes.
  56.     LONG    BMP_MemType      ;[44] Memory type to use in allocation.
  57.     WORD    BMP_Planes       ;[48] Amount of planes.
  58.     WORD    BMP_resEmpty     ;[50] Reserved.
  59.     LONG    BMP_AmtColours   ;[52] Maximum amount of colours available.
  60.  
  61. BMA_Data       = (TAPTR|BMP_Data)
  62. BMA_Width      = (TWORD|BMP_Width)
  63. BMA_ByteWidth  = (TWORD|BMP_ByteWidth)
  64. BMA_Height     = (TWORD|BMP_Height)
  65. BMA_Type       = (TWORD|BMP_Type)
  66. BMA_LineMod    = (TLONG|BMP_LineMod)
  67. BMA_PlaneMod   = (TLONG|BMP_PlaneMod)
  68. BMA_Parent     = (TAPTR|BMP_Parent)
  69. BMA_Restore    = (TAPTR|BMP_Restore)
  70. BMA_Size       = (TLONG|BMP_Size)
  71. BMA_MemType    = (TLONG|BMP_MemType)
  72. BMA_Planes     = (TWORD|BMP_Planes)
  73. BMA_AmtColours = (TLONG|BMP_AmtColours)
  74.  
  75. *****************************************************************************
  76. * The RestoreList structure.
  77.  
  78. RSTVERSION   = 1
  79. TAGS_RESTORE = (ID_SPCTAGS<<16)|ID_RESTORE
  80.  
  81.     STRUCTURE    RH1,HEAD_SIZEOF
  82.     WORD    RH_Buffers       ;Amount of screen buffers
  83.     WORD    RH_Entries       ;Amount of entries.
  84.     APTR    RH_Owner         ;Owner of the restorelist, ie bitmap.
  85.  
  86.     *** Private fields below ***
  87.  
  88.     APTR    RH_List1
  89.     APTR    RH_List2
  90.     APTR    RH_List3
  91.     APTR    RH_ListPos1
  92.     APTR    RH_ListPos2
  93.     APTR    RH_ListPos3
  94.     LABEL    RH_SIZEOF
  95.  
  96. RSA_Buffers = (TWORD|RH_Buffers)
  97. RSA_Entries = (TWORD|RH_Entries)
  98. RSA_Owner   = (TAPTR|RH_Owner)
  99.  
  100.     *** Private Structure ***
  101.  
  102.     STRUCTURE    RSE,0
  103.     APTR    RSE_Next         ;Next restore entry in the chain.
  104.     APTR    RSE_Prev         ;Previous restore enty in the chain.
  105.     APTR    RSE_Bob          ;Bob structure belonging to the restore [*]
  106.     APTR    RSE_Address      ;Screen pointer (top of screen) [*]
  107.     LABEL    RSE_Mask         ;Pointer to the bob's mask [Label *]
  108.     APTR    RSE_Storage      ;Background storage or NULL.
  109.     APTR    RSE_Control      ;Controls from the lookup table.
  110.     APTR    RSE_ConMask      ;The control mask to use.
  111.     WORD    RSE_Modulo1      ;Modulo C
  112.     LONG    RSE_Modulo2      ;Modulos A/D.
  113.     LABEL    RSE_BlitSize     ;[Label *]
  114.     WORD    RSE_BlitWidth    ;[*]
  115.     WORD    RSE_BlitHeight   ;[*]
  116.     LABEL    RSE_SIZEOF
  117.  
  118. *****************************************************************************
  119. * Bob structure, also used as a skeleton for Mbob's.
  120.  
  121. BBVERSION =    1
  122. TAGS_BOB  =    (ID_SPCTAGS<<16)|ID_BOB
  123.  
  124.     STRUCTURE    BOB1,HEAD_SIZEOF
  125.     APTR    BOB_GfxData        ;Pointer to Bob graphics.
  126.     APTR    BOB_MaskData       ;Pointer to Bob masks.
  127.     APTR    BOB_GfxCoords      ;Pointer to frame list for graphics.
  128.     WORD    BOB_Frame          ;Current frame.
  129.     WORD    BOB_SrcWidth       ;Source Page Width in bytes.
  130.     WORD    BOB_Width          ;Width in pixels (true width).
  131.     WORD    BOB_ByteWidth      ;Width in bytes (round up).
  132.     WORD    BOB_XCoord         ;X coordinate.
  133.     WORD    BOB_YCoord         ;Y coordinate.
  134.     WORD    BOB_Height         ;Height in pixels.
  135.     WORD    BOB_ClipLX         ;Left X border in bytes.
  136.     WORD    BOB_ClipTY         ;Top Y border.
  137.     WORD    BOB_ClipRX         ;Right X border in bytes.
  138.     WORD    BOB_ClipBY         ;Bottom Y border.
  139.     WORD    BOB_FPlane         ;First plane to blit to (planar only)
  140.     WORD    BOB_Planes         ;Amount of planes
  141.     WORD    BOB_PropHeight     ;Expected height of source bitmap.
  142.     WORD    BOB_PropWidth      ;Expected width of source bitmap.
  143.     WORD    BOB_Buffers        ;Amount of buffers in dest screen [o/r]
  144.     LONG    BOB_PlaneSize      ;Size Of Plane Source (planar only)
  145.     LONG    BOB_Attrib         ;Attributes like CLIP and MASK.
  146.     APTR    BOB_SrcBitmap      ;Source Bitmap.
  147.     WORD    BOB_Empty          ;Reserved (in use by MBob).
  148.     WORD    BOB_SrcMaskWidth   ;Mask Page Width in bytes.
  149.     APTR    BOB_Source         ;Pointer to bob source (bob origin).
  150.     APTR    BOB_DirectGfx      ;Pointer to direct frame list.
  151.     APTR    BOB_Screen         ;Destination Screen [o]
  152.     APTR    BOB_DestBitmap     ;Destination Bitmap [c]
  153.     APTR    BOB_MaskCoords     ;Pointer to frame list for masks.
  154.     APTR    BOB_DirectMasks    ;
  155.     WORD    BOB_AmtFrames      ;Total amount of frames in GfxCoords.
  156.  
  157.     *** Private fields start now ***
  158.  
  159.     WORD    BOB_StoreSize      ;4/8/12 Sizeof one store entry (MBob's)
  160.     APTR    BOB_StoreBuffer    ;A/B/C [0/4/8] storage pointer (MBob's)
  161.     WORD    BOB_StoreMax       ;Maximum store position.
  162.     APTR    BOB_StoreMemory    ;Master storage pointer (for the freemem).
  163.     WORD    BOB_StoreCount     ;Counter for store, 0, 4, 8.
  164.     APTR    BOB_StoreA         ;Storage buffer 1.
  165.     APTR    BOB_StoreB         ;Storage buffer 2.
  166.     APTR    BOB_StoreC         ;Storage buffer 3.
  167.     APTR    BOB_DrawRoutine    ;Routine for drawing/clearing/storing.
  168.     APTR    BOB_ClearRoutine   ;Routine for clearing.
  169.     APTR    BOB_RestoreRoutine ;Routine for restoring/clearing.
  170.     APTR    BOB_HeightRoutine  ;Replaces BS_DrawRoutine for large heights.
  171.     LONG    BOB_ScreenSize     ;Size of destination plane.
  172.     WORD    BOB_Modulo         ;Bob Modulo (PicWidth-BobWidth)
  173.     WORD    BOB_MaskModulo     ;Mask Modulo (BobWidth-BobWidth for GENMASK).
  174.     APTR    BOB_MaskMemory     ;Master mask pointer (for the freemem).
  175.     WORD    BOB_MaxHeight      ;Maximum possible height, limited by blitter.
  176.     WORD    BOB_ScrLine        ;Size of a line (for interleaved).
  177.     WORD    BOB_BobLine        ;Size of a Bob line (Width*Planes)
  178.     WORD    BOB_MaskLine       ;Size of a Mask Line (Width*Planes)
  179.     WORD    BOB_TrueWidth      ;The true pixel width (++shift)
  180.     WORD    BOB_TrueBWidth     ;The true byte width (++shift)
  181.     WORD    BOB_TrueWWidth     ;The true word width (++shift)
  182.     WORD    BOB_ClipBLX        ;ClipLX, byte.
  183.     WORD    BOB_ClipBRX        ;ClipRX, byte.
  184.     LONG    BOB_Modulo1        ;Modulus. (C/B)
  185.     LONG    BOB_Modulo2        ;Modulus. (A/D)
  186.     LONG    BOB_NSModulo1      ;Modulus. (C/B)
  187.     LONG    BOB_NSModulo2      ;Modulus. (A/D)
  188.     WORD    BOB_WordWidth      ;The word width.
  189.     BYTE    BOB_AFlags         ;Allocation flags.
  190.     BYTE    BOB_Pad
  191.  
  192. BBA_GfxData      = (TAPTR|BOB_GfxData)
  193. BBA_MaskData     = (TAPTR|BOB_MaskData)
  194. BBA_Graphics     = (TAPTR|BOB_GfxData)
  195. BBA_Masks        = (TAPTR|BOB_MaskData)
  196. BBA_Frame        = (TWORD|BOB_Frame)
  197. BBA_GfxCoords    = (TAPTR|BOB_GfxCoords)
  198. BBA_SrcWidth     = (TWORD|BOB_SrcWidth)
  199. BBA_Width        = (TWORD|BOB_Width)
  200. BBA_ByteWidth    = (TWORD|BOB_ByteWidth)
  201. BBA_Height       = (TWORD|BOB_Height)
  202. BBA_XCoord       = (TWORD|BOB_XCoord)
  203. BBA_YCoord       = (TWORD|BOB_YCoord)
  204. BBA_ClipLX       = (TWORD|BOB_ClipLX)
  205. BBA_ClipTY       = (TWORD|BOB_ClipTY)
  206. BBA_ClipRX       = (TWORD|BOB_ClipRX)
  207. BBA_ClipBY       = (TWORD|BOB_ClipBY)
  208. BBA_FPlane       = (TWORD|BOB_FPlane)
  209. BBA_Planes       = (TWORD|BOB_Planes)
  210. BBA_PropHeight   = (TWORD|BOB_PropHeight)
  211. BBA_PropWidth    = (TWORD|BOB_PropWidth)
  212. BBA_Buffers      = (TWORD|BOB_Buffers)
  213. BBA_AmtPlanes    = (TWORD|BOB_Planes)
  214. BBA_PlaneSize    = (TLONG|BOB_PlaneSize)
  215. BBA_Attrib       = (TLONG|BOB_Attrib)
  216. BBA_SrcMaskWidth = (TWORD|BOB_SrcMaskWidth)
  217. BBA_Source       = (TAPTR|BOB_Source)
  218. BBA_DirectGfx    = (TAPTR|BOB_DirectGfx)
  219. BBA_Screen       = (TAPTR|BOB_Screen)
  220. BBA_DestBitmap   = (TAPTR|BOB_DestBitmap)
  221. BBA_MaskCoords   = (TAPTR|BOB_MaskCoords)
  222. BBA_DirectMasks  = (TAPTR|BOB_DirectMasks)
  223. BBA_AmtFrames    = (TWORD|BOB_AmtFrames)
  224.  
  225. BBA_SourceTags   = (TSTEPIN|TTRIGGER|BOB_Source)
  226.  
  227. *****************************************************************************
  228. * MBob structure for MBV1, based on BBV1.
  229.  
  230. MBVERSION =  1
  231. TAGS_MBOB =  (ID_SPCTAGS<<16)|ID_MBOB
  232.  
  233.     STRUCTURE    MBOB1,HEAD_SIZEOF
  234.     APTR    MB_GfxData        ;Pointer to graphics.
  235.     APTR    MB_MaskData       ;Pointer to masks.
  236.     APTR    MB_GfxCoords      ;Pointer to frame list for graphics.
  237.     WORD    MB_AmtEntries     ;Amount of entries in the image list.
  238.     WORD    MB_SrcWidth       ;Source Page Width in bytes.
  239.     WORD    MB_Width          ;Width in pixels.
  240.     WORD    MB_ByteWidth      ;Width in bytes.
  241.     APTR    MB_EntryList      ;Pointer to the entry/image list.
  242.     WORD    MB_Height         ;Height in pixels.
  243.     WORD    MB_ClipLX         ;Left X border in bytes.
  244.     WORD    MB_ClipTY         ;Top Y border.
  245.     WORD    MB_ClipRX         ;Right X border in bytes.
  246.     WORD    MB_ClipBY         ;Bottom Y border.
  247.     WORD    MB_FPlane         ;First plane to blit to (planar only)
  248.     WORD    MB_Planes         ;Amount of planes.
  249.     WORD    MB_PropHeight     ;Expected height of source picture.
  250.     WORD    MB_PropWidth      ;Expected width of source picture.
  251.     WORD    MB_Buffers        ;Amount of buffers in dest screen.
  252.     LONG    MB_PlaneSize      ;Size Of Plane Source (planar only)
  253.     LONG    MB_Attrib         ;Attributes like CLIP and MASK.
  254.     APTR    MB_SrcBitmap      ;Source Bitmap.
  255.     WORD    MB_EntrySize      ;Size of each entry.
  256.     WORD    MB_SrcMaskWidth   ;Mask Page Width in bytes.
  257.     APTR    MB_Source         ;Pointer to source structure (bob origin).
  258.     APTR    MB_DirectGfx      ;Pointer to direct frame list.
  259.     APTR    MB_Screen         ;Pointer to Bob's destination Screen.
  260.     APTR    MB_DestBitmap     ;Pointer to Bob's destination Bitmap.
  261.     APTR    MB_MaskCoords     ;Pointer to frame list for masks.
  262.     APTR    MB_DirectMasks    ;
  263.     WORD    MB_AmtFrames      ;Total amount of frames in frame/direct lists.
  264.  
  265.    STRUCTURE    BE,0              ;MBob Entry Structure.
  266.     WORD    BE_XCoord
  267.     WORD    BE_YCoord
  268.     UWORD    BE_Frame
  269.     LABEL    BE_SIZEOF
  270.  
  271. SKIPIMAGE =  32000
  272.  
  273. MBA_GfxData      = (TAPTR|MB_GfxData)
  274. MBA_MaskData     = (TAPTR|MB_MaskData)
  275. MBA_AmtEntries   = (TWORD|MB_AmtEntries)
  276. MBA_GfxCoords    = (TAPTR|MB_GfxCoords)
  277. MBA_SrcWidth     = (TWORD|MB_SrcWidth)
  278. MBA_Width        = (TWORD|MB_Width)
  279. MBA_ByteWidth    = (TWORD|MB_ByteWidth)
  280. MBA_Height       = (TWORD|MB_Height)
  281. MBA_EntryList    = (TAPTR|MB_EntryList)
  282. MBA_ClipLX       = (TWORD|MB_ClipLX)
  283. MBA_ClipTY       = (TWORD|MB_ClipTY)
  284. MBA_ClipRX       = (TWORD|MB_ClipRX)
  285. MBA_ClipBY       = (TWORD|MB_ClipBY)
  286. MBA_FPlane       = (TWORD|MB_FPlane)
  287. MBA_Planes       = (TWORD|MB_Planes)
  288. MBA_PlaneSize    = (TLONG|MB_PlaneSize)
  289. MBA_Attrib       = (TLONG|MB_Attrib)
  290. MBA_EntrySize    = (TWORD|MB_EntrySize)
  291. MBA_SrcMaskWidth = (TWORD|MB_SrcMaskWidth)
  292. MBA_Source       = (TAPTR|MB_Source)
  293. MBA_DirectGfx    = (TAPTR|MB_DirectGfx)
  294. MBA_Screen       = (TAPTR|MB_Screen)
  295. MBA_DestBitmap   = (TAPTR|MB_DestBitmap)
  296. MBA_Buffers      = (TWORD|MB_Buffers)
  297. MBA_MaskCoords   = (TAPTR|MB_MaskCoords)
  298. MBA_PropWidth    = (TWORD|MB_PropWidth)
  299. MBA_PropHeight   = (TWORD|MB_PropHeight)
  300. MBA_DirectMasks  = (TAPTR|MB_DirectMasks)
  301. MBA_AmtFrames    = (TWORD|MB_AmtFrames)
  302.  
  303. ;---------------------------------------------------------------------------;
  304. ;Drawing Methods and Options for both bob structures (BOB_Attrib).
  305.  
  306. B_CLIP     =     0       ;Allow border clipping.
  307. B_MASK     =     1       ;Allow masking.
  308. B_FILLMASK =    2       ;Fill any holes in the mask on generation.
  309. B_CLEAR    =    3       ;Allow automatic clearing.
  310. B_RESTORE  =    4       ;Allow automatic background restore.
  311. ;B_ = 5
  312. B_CLRMASK  =    6       ;Use masks in the clear.
  313. B_GENONLY  =    7       ;Create and use masks for drawing this bob.
  314.  
  315. BBF_CLIP     =  1<<B_CLIP
  316. BBF_MASK     =  1<<B_MASK
  317. BBF_FILLMASK =  1<<B_FILLMASK
  318. BBF_CLEAR    =  1<<B_CLEAR
  319. BBF_RESTORE  =  1<<B_RESTORE
  320. ; = 1<<
  321. BBF_CLRMASK  =  1<<B_CLRMASK
  322. BBF_GENONLY  =  1<<B_GENONLY
  323. BBF_GENMASKS =  (1<<B_GENONLY)|BBF_MASK
  324.  
  325. BBF_CLRNOMASK = 0                ;Do not use masks in the clear (default).
  326. BBF_GENMASK   = BBF_GENMASKS     ;Synonym.
  327. BBF_FILLMASKS = BBF_FILLMASK     ;Synonym.
  328. BBF_GENFMASK  = BBF_GENMASK|BBF_FILLMASK
  329.  
  330. *****************************************************************************
  331. * Map structure
  332.  
  333. MAPVERSION =    1
  334. TAGS_MAP =    (ID_SPCTAGS<<16)|ID_MAP
  335.  
  336.     STRUCTURE    MAP1,HEAD_SIZEOF
  337.     WORD    MAP_Buffer        ;Destination buffer.
  338.     WORD    MAP_Number        ;Map number to access for data.
  339.     APTR    MAP_MapList       ;Pointer to the map datalist (level list).
  340.     LABEL    MAP_RowSize       ;Synonym of MAP_Width.
  341.     WORD    MAP_Width         ;Total width of map.
  342.     WORD    MAP_Height        ;Total height of map.
  343.     WORD    MAP_XStart        ;Get block data starting from X [byte].
  344.     WORD    MAP_YStart        ;Get block data starting from Y.
  345.     WORD    MAP_EntrySize     ;Byte/Word.
  346.     LONG    MAP_EntryMask     ;For special masking.
  347.     WORD    MAP_TileWidth     ;The width of each tile.
  348.     LABEL    MAP_TileBWidth    ;Synonym for TileByteWidth.
  349.     WORD    MAP_TileByteWidth ;The bytewidth of each tile.
  350.     WORD    MAP_TileHeight    ;The height of each tile.
  351.     WORD    MAP_Options       ;Applicable Map options, eg LOCKED.
  352.     APTR    MAP_Picture       ;Map's graphics picture (compulsory).
  353.     APTR    MAP_File          ;Where to get the map data.
  354.     LABEL    MAPV1_SIZEOF      ;<- Private.
  355.  
  356. ;CLIP =    $0001   ;Blocks require clipping on the X/Y axis.
  357.  
  358. MAPSIZE_BYTE = 1    ;Entry size is in bytes.
  359. MAPSIZE_WORD = 2    ;Entry size is in words.
  360. MAPSIZE_LONG = 4    ;Entry size is in longs.
  361.  
  362.  
  363.     ENDC    ;GRAPHICS_BLITTER_I
  364.